<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>查询并显示数据</title>
<link rel="stylesheet" href="./css/bootstrap.css">
<link rel="stylesheet" href="./css/font-awesome.css">
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-lg-12 mx-auto">
            <div class="my-3">
<h3 class="pull-left">用户列表</h3>
<a href="./insert.html" class="btn btn-success pull-right"><i class="fa fa-plus fa-fw"></i>添加新用户</a>
            </div>      
<table class='table table-bordered table-striped'>
<thead class="thead-dark">
<tr>
    <th>序号</th>
    <th>id</th>
    <th>姓名</th>
    <th>邮箱</th>
    <th>电话号码</th>
    <th>操作</th>
</tr>
</thead>
<tbody>
<?php
    require_once "./conn.php";
    $result = mysqli_query($link,"select * from users");
    if(mysqli_num_rows($result)>0){
        $i=1;
        while ($row=mysqli_fetch_array($result)) {
    ?>        
        <tr>
            <th><?php echo $i; ?></td>
            <td><?php echo $row['id']; ?></td>
            <td><?php echo $row['name']; ?></td>
            <td><?php echo $row['email']; ?></td>
            <td><?php echo $row['mobile']; ?></td>
            <td>                     
                <a class="btn btn-success" href="./xiugai.php?id=<?php echo $row['id']; ?>"><i class="fa fa-pencill">修改</i></a>
                <a class="btn btn-success" href="./shanchu.php?id=<?php echo $row["id"]; ?>"><i class="fa fa-plus-square">删除</i></a>
            </td>
        </tr>
<?php
$i++;
}
}else{
    echo "<tr><td colspan='6' class='text-center'>无记录</td></tr>";
}
?>
    </tbody>
</table>

        </div>
    </div>
</div>
</body>
</html>